home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / util / moni / Scout-src.lha / netinclude / rpcsvc / klm_prot.x < prev    next >
Text File  |  2002-09-16  |  2KB  |  105 lines

  1. /* @(#)klm_prot.x    2.1 88/08/01 4.0 RPCSRC */
  2. /* @(#)klm_prot.x 1.7 87/07/08 Copyr 1987 Sun Micro */
  3.  
  4.  
  5. /*
  6.  * Kernel/lock manager protocol definition
  7.  * Copyright (C) 1986 Sun Microsystems, Inc.
  8.  *
  9.  * protocol used between the UNIX kernel (the "client") and the
  10.  * local lock manager.  The local lock manager is a deamon running
  11.  * above the kernel.
  12.  */
  13. program KLM_PROG {
  14.     version KLM_VERS {
  15.  
  16.         klm_testrply    KLM_TEST (struct klm_testargs) =    1;
  17.  
  18.         klm_stat    KLM_LOCK (struct klm_lockargs) =    2;
  19.  
  20.         klm_stat    KLM_CANCEL (struct klm_lockargs) =    3;
  21.         /* klm_granted=> the cancel request fails due to lock is already granted */
  22.         /* klm_denied=> the cancel request successfully aborts
  23. lock request  */
  24.  
  25.         klm_stat    KLM_UNLOCK (struct klm_unlockargs) =    4;
  26.     } = 1;
  27. } = 100020;
  28.  
  29. const    LM_MAXSTRLEN = 1024;
  30.  
  31. /*
  32.  * lock manager status returns
  33.  */
  34. enum klm_stats {
  35.     klm_granted = 0,    /* lock is granted */
  36.     klm_denied = 1,        /* lock is denied */
  37.     klm_denied_nolocks = 2, /* no lock entry available */
  38.     klm_working = 3     /* lock is being processed */
  39. };
  40.  
  41. /*
  42.  * lock manager lock identifier
  43.  */
  44. struct klm_lock {
  45.     string server_name<LM_MAXSTRLEN>;
  46.     netobj fh;        /* a counted file handle */
  47.     int pid;        /* holder of the lock */
  48.     unsigned l_offset;    /* beginning offset of the lock */
  49.     unsigned l_len;        /* byte length of the lock;
  50.                  * zero means through end of file */
  51. };
  52.  
  53. /*
  54.  * lock holder identifier
  55.  */
  56. struct klm_holder {
  57.     bool exclusive;        /* FALSE if shared lock */
  58.     int svid;        /* holder of the lock (pid) */
  59.     unsigned l_offset;    /* beginning offset of the lock */
  60.     unsigned l_len;        /* byte length of the lock;
  61.                  * zero means through end of file */
  62. };
  63.  
  64. /*
  65.  * reply to KLM_LOCK / KLM_UNLOCK / KLM_CANCEL
  66.  */
  67. struct klm_stat {
  68.     klm_stats stat;
  69. };
  70.  
  71. /*
  72.  * reply to a KLM_TEST call
  73.  */
  74. union klm_testrply switch (klm_stats stat) {
  75.     case klm_denied:
  76.         struct klm_holder holder;
  77.     default: /* All other cases return no arguments */
  78.         void;
  79. };
  80.  
  81.  
  82. /*
  83.  * arguments to KLM_LOCK
  84.  */
  85. struct klm_lockargs {
  86.     bool block;
  87.     bool exclusive;
  88.     struct klm_lock alock;
  89. };
  90.  
  91. /*
  92.  * arguments to KLM_TEST
  93.  */
  94. struct klm_testargs {
  95.     bool exclusive;
  96.     struct klm_lock alock;
  97. };
  98.  
  99. /*
  100.  * arguments to KLM_UNLOCK
  101.  */
  102. struct klm_unlockargs {
  103.     struct klm_lock alock;
  104. };
  105.